#ifndef __platform_info_H__
#define __platform_info_H__ 1
#include "sys.h"
#include "thread_pool.h"
#include "dial_strategy.h"
#include "comm_param.h"
#include "devinfo.h"
#include "heart.h"
#include "trans.h"

#define PROBE_TAR_FILE "onuProbe.tar.gz"
#define PROGRAM_PROBE "onuProbe"
#define PROBE_VERSION_FILE "version.txt"

#define WEB_AUTH_PATH "gnsts-tv-probe/tvDialAction/authentication.action"
#define WEB_DIAL_REQ_PATH "gnsts-tv-probe/tvDialAction/tvDialSpeedRequest.action"
#define WEB_SPEED_NODE_PATH "gnsts-tv-probe/tvDialAction/getSpeedNodes.action"
#define WEB_DOWNLOAD_PROBE_PATH "gnsts-tv-probe/tvDialAction/downloadProbe.action"
#define WEB_PUSH_PROBE_UPLOAD_PATH "gnsts-tv-probe/tvDialAction/pushProbeUpload.action"

typedef struct{
    int is_bridge;
    struct {
        char host[32];
        uint16_t port;
    } bridge;
    comm_req_param_t comm_req;
    DevInfo_t devinfo;
    HeartInfo_t heartinfo;
    thread_pool_t *tpool;
    struct {
        char host[128];
        uint16_t tcp_port, udp_port;
        char scheme[16];//http, maybe https
    }addr;
    struct {
        char token[64];
        struct Dial_Task task;
    }resp;
}Platform_t;


int platform_init(Platform_t* platform, char* svr_host, uint16_t tcp_port, uint16_t udp_port, char* scheme);
int platform_auth(Platform_t* platform);
int platform_dial_req(Platform_t* platform);
int platform_task_run(Platform_t *platform);
int platform_download_probe(Platform_t* platform);
int platform_push_probe_upload_report(Platform_t* platform, int cmd_id, int status);
#endif